﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SourceGrid;
using Aulac.Global.Common;
using Aulac.Rsc.Bss.Tags;

namespace Aulac.Client.Controls.Bss
{
    [System.ComponentModel.ToolboxItem(true)]
    public partial class GridBssBuy : Aulac.Client.Controls.UserControls.GridEditorCtrl
    {

        private Aulac.UtilityTools.DataGridEditors.CellEditors.ComboBox cbItemEditor = null;
        private Aulac.UtilityTools.DataGridEditors.CellEditors.ComboBox cbCapAssEditor = null;
        //object mItemGrpID = null;
        public GridBssBuy()
        {
            InitializeComponent();
            grdData.DataSource = new Aulac.Client.Data.Bss.DataSet.DsGridBss.VchLineBuyCapAssDataTable();
            InitColumnShow();
           // SetStyleOverInstock(Color.Chocolate);
        }

        #region Properties
        private InfoGrid.GridBssBuy _ColumnsGrd = new InfoGrid.GridBssBuy(tagVch.BuyCapAss.VchCapAssID,tagVch.BuyCapAss.VchCapAssName,tagVch.BuyCapAss.Specification,tagVch.BuyCapAss.Unit,tagVch.BuyCapAss.Quantity,tagVch.BuyCapAss.UnitPrice,tagVch.BuyCapAss.AmtTtlLineInExc,tagVch.BuyCapAss.VAT,tagVch.BuyCapAss.AmtTaxLineInExc,tagVch.BuyCapAss.AmtTtlLineInExc,tagVch.BuyCapAss.ItemLine);
        public InfoGrid.GridBssBuy ColumnsGrd
        {
            get { return _ColumnsGrd; }
        }
        //private List<ItemGrpTypes> mListMdnGrpTypes = new List<ItemGrpTypes>(
        //    new ItemGrpTypes[]{ItemGrpTypes.GrpDrug, 
        //        ItemGrpTypes.GrpEquMdn,ItemGrpTypes.GrpMdnMaterials});
        //private List<ItemGrpTypes> mListMdnGrpTypes = null;

        //public List<ItemGrpTypes> ListMdnGrpTypes
        //{
        //    set {
        //        if (!Aulac.Global.Common.ValueHelper.EqualsValue(mListMdnGrpTypes, value))
        //        {
        //            mListMdnGrpTypes = value;
        //            ReLoadDataToControl();
        //        }
        //    }
        //}
        //double mVAT = 0;
        //[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        //public double VAT
        //{
        //    set
        //    {
        //        if (mVAT == value)
        //            return;
        //        mVAT = value;
        //        SetValueInColumn(ColumnsGrd.VAT, mVAT);
        //        CalcAllRowsAmtItemLine(ColumnsGrd.VAT);
        //    }
        //}
        #endregion

        #region OverrideMethod
        protected override void OnFormLoad()
        {
            base.OnFormLoad();            
            ReLoadDataToControl();
        }
        public override void LoadDataToControl()
        {
            /* Other Write: H.Rin */
            /* Code Update: 10/13/2010 */
            //if(ValueHelper.isEmpty(mListMdnGrpTypes))
            //    return;
            //if (cbCapAssEditor.Control.IsEmptyDataInList)
            //{
            //    DataTable tbGrp = cbCapAssEditor.Control.GetTable();
            //    //Aulac.Client.Data.Bss.Helper.DataItems.DataMdnItemsHelper.LoadMdnGroup(ref tbGrp, true,);
            //    cbCapAssEditor.Control.DataSource = tbGrp.DefaultView;
            //}

            //if (cbItemEditor.Control.IsEmptyDataInList)
            //{
            //    string[] ArrFieldResult = new string[] {
            //        tagItems.Item.ItemPrkID,
            //        tagItems.Item.ItemGrpID,
            //        tagItems.Item.ItemID,
            //        tagItems.Item.ItemName,
            //        tagItems.Item.Unit,
            //        tagItems.Item.PriceSellInExc,
            //       tagItems.Item.IsItemInStock,
            //        tagItems.Item.SvcInsTypeID,
            //       tagItems.Item.ItemFncStylePrkID
            //        };
            //    DataTable tbItem = cbItemEditor.Control.GetTable();
            //    //Aulac.Client.Data.Bss.Helper.DataItems.DataMdnItemsHelper.LoadMdnItem(ref tbItem, true, ArrFieldResult, mListMdnGrpTypes.ToArray());

            //    cbItemEditor.Control.DataSource = tbItem.DefaultView;
            //}
        }
        public override void ReLoadDataToControl()
        {
            //cbCapAssEditor.Control.ClearDataContainer();
            ////cbItemEditor.Control.ClearDataContainer();
            //LoadDataToControl();
        }
        protected override void OnClearValueControls()
        {
            base.OnClearValueControls();
            this.grdData.ClearDataContainer();
            this.txtTT.ClearValueControls();
        }

        protected override void OnCellEditorStarting(Aulac.UtilityTools.DataGridEditors.CellEditors.AulacEditorControl sender, CancelEventArgs e)
        {
            if (grdData.ReadOnly)
                return;
            //if (Aulac.Global.Common.ValueHelper.EqualsValue(sender.Control, cbItemEditor))
            //{
            //    string sGrpID = grdData.GetValueStringDataCell(sender.EditCellContext.Position.Row, ColumnsGrd.CapAssID);
            //    if (!Aulac.Global.Common.ValueHelper.isEmpty(sGrpID))
            //    {
            //        DataView view = ((DataView)cbItemEditor.Control.DataSource);
            //        view.RowFilter = string.Format("{0} = '{1}'", ColumnsGrd.CapAssID, sGrpID);
            //        cbItemEditor.Control.DataSource = view;
            //    }
            //    grdData.SetValueCell(sender.EditCellContext.Position.Row, ColumnsGrd.VAT, mVAT);
            //    CalcAmtItemLine(sender.EditCellContext.Position.Row, ColumnsGrd.VAT);
            //}
            //else if (Aulac.Global.Common.ValueHelper.EqualsValue(sender.EditCellContext.Cell.Editor, cbCapAssEditor))
            //{
            //    mItemGrpID = grdData.GetValueDataCell(grdData.SelectedIndexGridRow, ColumnsGrd.ItemGrpID);
            //}
        }
        protected override void OnCellEditorEndding(Aulac.UtilityTools.DataGridEditors.CellEditors.AulacEditorControl sender, Aulac.UtilityTools.DataGridEditors.CellEditors.CellEditorEnddingEventArgs e)
        {
            /* Other Write: H.Rin */
            /* Code Update: 10/13/2010 */
            //if (e.Cancel == true)
            //    return;
            //if (Aulac.Global.Common.ValueHelper.EqualsValue(sender.EditCellContext.Cell.Editor, cbCapAssEditor))
            //{
            //    if (cbCapAssEditor.Control.SelectedIndex >= 0)
            //    {
            //        DataView view = ((DataView)cbItemEditor.Control.DataSource);
            //        view.RowFilter = string.Format("{0} = '{1}'", ColumnsGrd.ItemGrpID, e.NewValue);
            //        cbItemEditor.Control.DataSource = null;
            //        cbItemEditor.Control.DataSource = view;

            //        int pRow = sender.EditCellContext.Position.Row;
            //        string sItemID = grdData.GetValueStringDataCell(sender.EditCellContext.Position.Row, tagItems.Item.ItemPrkID);
            //        string sFeeTypeID = grdData.GetValueStringDataCell(sender.EditCellContext.Position.Row, tagItems.Item.FeeTypeID);
            //        if (cbItemEditor.Control.FindItem(sItemID, tagItems.Item.ItemPrkID) < 0)
            //        {
            //            grdData.SetValueCell(pRow, tagItems.Item.ItemPrkID, null);
            //            grdData.SetValueCell(pRow, ColumnsGrd.ItemID, null);
            //            grdData.SetValueCell(pRow, ColumnsGrd.ItemName, null);
            //            grdData.SetValueCell(pRow, tagItems.Item.SvcInsTypeID, null);
            //            //grdData.SetValueCell(pRow, tagItems.Item.FeeTypeID, cbMdnGrpEditor.Control.GetValueItem(tagItems.Item.FeeTypeID));
            //        }
            //    }
            //}
            //else if (Aulac.Global.Common.ValueHelper.EqualsValue(sender.EditCellContext.Cell.Editor, cbItemEditor))
            //{
            //    string sItemPrkID = cbItemEditor.Control.GetValueItem(tagItems.Item.ItemPrkID);
            //    string sItemID = cbItemEditor.Control.GetValueItem(ColumnsGrd.CapAssID);
            //    int pRows = checkItems(sItemPrkID);
            //    if (pRows != -1)
            //    {
            //        Aulac.UtilityTools.MsgBox.Show(string.Format("Item Mã tài sản [{0}] đã tồn tại ở dòng {1}!", cbItemEditor.Control.GetValueItem(ColumnsGrd.CapAssID), pRows), "Warring", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            //        grdData.EndEditingRow(true);
            //        e.Cancel = true;
            //    }
            //    else
            //    {
            //        grdData.SetValueCell(grdData.SelectedIndexGridRow, tagItems.Item.ItemPrkID, sItemPrkID);
            //        grdData.SetValueCell(grdData.SelectedIndexGridRow, ColumnsGrd.CapAssID, sItemID);
            //        grdData.SetValueCell(grdData.SelectedIndexGridRow, ColumnsGrd.CapAssName, cbItemEditor.Control.GetValueItem(ColumnsGrd.CapAssName));
            //        grdData.SetValueCell(grdData.SelectedIndexGridRow, ColumnsGrd.Unit, cbItemEditor.Control.GetValueItem(ColumnsGrd.Unit));
            //        grdData.SetValueCell(grdData.SelectedIndexGridRow, ColumnsGrd.UnitPrice, cbItemEditor.Control.GetValueItem(tagItems.Item.PriceSellInExc));
            //        grdData.SetValueCell(grdData.SelectedIndexGridRow, tagItems.Item.IsItemInStock, cbItemEditor.Control.GetValueItem(tagItems.Item.IsItemInStock));
            //        grdData.SetValueCell(grdData.SelectedIndexGridRow, tagItems.Item.PriceSvcInExc, cbItemEditor.Control.GetValueItem(tagItems.Item.PriceSvcInExc));
            //        grdData.SetValueCell(grdData.SelectedIndexGridRow, tagItems.Item.SvcInsTypeID, cbItemEditor.Control.GetValueItem(tagItems.Item.SvcInsTypeID));
            //        grdData.SetValueCell(grdData.SelectedIndexGridRow, tagItems.Item.IsItemInStock, cbItemEditor.Control.GetValueItem(tagItems.Item.IsItemInStock));
            //        grdData.SetValueCell(grdData.SelectedIndexGridRow, tagItems.Item.ItemFncStylePrkID, cbItemEditor.Control.GetValueItem(tagItems.Item.ItemFncStylePrkID));
            //        //string s = cbItemEditor.Control.GetValueItem(ColumnsGrd.ItemGrpID);
            //        //grdData.SetValueCell(grdData.SelectedIndexGridRow, ColumnsGrd.ItemGrpID, s);
            //        grdData.SetValueCell(grdData.SelectedIndexGridRow, tagMdcFiles.MdcFiles.ItemLine, grdData.SelectedIndexGridRow);

            //        grdData.SetValueCell(grdData.SelectedIndexGridRow, tagItems.Item.ItemFeeTypeID, cbCapAssEditor.Control.GetValueItem(tagItems.Item.ItemFeeTypeID));
            //    }
            //    grdData.SetValueCell(grdData.SelectedIndexGridRow, ColumnsGrd.VAT, mVAT);
            //    grdData.SetValueCell(grdData.SelectedIndexGridRow, tagVch.Inv.OverInstock, false);                

            //}
            
            //grdData.AutoStretchColumnsToFitWidth = true;

        }
        protected override void OnCellEditorEnd(Aulac.UtilityTools.DataGridEditors.CellEditors.AulacEditorControl sender, EventArgs e)
        {
            //CalcAmtItemLine(sender.EditCellContext.Position.Row, ColumnsGrd.VAT);
            //string colName = grdData.Columns[sender.EditCellContext.Position.Column].PropertyName;
            //if (colName.Equals(ColumnsGrd.Quantity) || colName.Equals(ColumnsGrd.UnitPrice) || colName.Equals(ColumnsGrd.CapAssID) ||
            //    colName.Equals(ColumnsGrd.AmtLineInExc) || colName.Equals(ColumnsGrd.AmtTaxLineInExc) || colName.Equals(ColumnsGrd.VAT))
            //{
            //    CalcAmtItemLine(sender.EditCellContext.Position.Row, colName);
            //}

            //CalcAllRowsAmtItemLine(colName);
            grdData.Refresh();
        }
        #endregion
       
        #region Private Method
        private int checkItems(string pItemPrkID)
        {
            for (int i = 1; i < grdData.Rows.Count - 2; i++)
            {
                object obj = grdData.GetValueDataCell(i, tagVch.Inv.ItemPrkID);
                string pValue = Convert.ToString(obj);
                if (ValueHelper.EqualsValue(pValue, pItemPrkID) && (i != grdData.SelectedIndexGridRow))
                    return i;
            }
            return -1;
        }

        private void InitColumnShow()
        {
            
            grdData.ClearColumsShow();
            cbCapAssEditor = new Aulac.UtilityTools.DataGridEditors.CellEditors.ComboBox(typeof(string));

            cbCapAssEditor.Control.DisplayMember = ColumnsGrd.CapAssID;
            cbCapAssEditor.Control.ColumnNames = string.Format("{0}, {1}", ColumnsGrd.CapAssID, tagVch.BuyCapAss.VchCapAssName);
            cbCapAssEditor.Control.ValueMember = ColumnsGrd.CapAssID;
            //cbCapAssEditor.Control.FieldMember = ColumnsGrd.ItemGrpID;
            cbCapAssEditor.Control.DataSource = new Aulac.Client.Data.Bss.DataSet.Catalog.Dm_CapAssDataTable();

            cbCapAssEditor.Control.DropDownWidth = 270;
            cbCapAssEditor.Control.ColumnWidths = "70,200";

            //DataGridColumn col = AddColumn(ColumnsGrd.ItemGrpID, "Nhóm tài sản", cbCapAssEditor);
            //col.AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize;
            //col.Width = 100;
            //col.DataCell.Editor = cbCapAssEditor;

            cbItemEditor = new Aulac.UtilityTools.DataGridEditors.CellEditors.ComboBox(typeof(string));

            //cbItemEditor.Control.DisplayMember = tagVch.Inv.ItemID;
            //cbItemEditor.Control.ColumnNames = string.Format("{0}, {1}, {2}, {3}", ColumnsGrd.CapAssID, ColumnsGrd.CapAssName, ColumnsGrd.Unit, tagItems.Item.PriceSellInExc, tagItems.Item.SvcInsTypeID, tagItems.Item.ItemFeeTypeID);
            //cbItemEditor.Control.ValueMember = tagVch.Inv.ItemID;
            //cbItemEditor.Control.FieldMember = tagVch.Inv.ItemID;
            //cbItemEditor.Control.DataSource = new Aulac.Client.Data.Bss.DataSet.Catalog.Dm_CapAssDataTable();

            //cbItemEditor.Control.RemoveFieldMappingAll();
            //cbItemEditor.Control.ListFieldMember = string.Format("{0}, {1}, {2}, {3}, {4}, {5}", ColumnsGrd.ItemGrpID, tagItems.Item.ItemPrkID, ColumnsGrd.ItemID, ColumnsGrd.ItemName, ColumnsGrd.Unit, tagItems.Item.IsItemInStock, tagItems.Item.PriceSvcInExc);
            //cbItemEditor.Control.DropDownWidth = 300;
            //cbItemEditor.Control.ColumnWidths = "70,200,30,80";
            //cbItemEditor.Control.TabKey = Aulac.UtilityTools.KeysUse.EnterForTab;

            DataGridColumn col = AddColumn(ColumnsGrd.CapAssID, "Mã tài sản", cbCapAssEditor);
            col.AutoSizeMode = SourceGrid.AutoSizeMode.Default;
            col.Width = 150;



            col = AddColumn(ColumnsGrd.CapAssName, "Tên tài sản", typeof(string));
            col.AutoSizeMode = SourceGrid.AutoSizeMode.EnableStretch;
            col.Width = 200;

            col = AddColumn(ColumnsGrd.Unit, "ĐVT", typeof(string));
            col.Width = 40;
            col.DataCell.Editor.EnableEdit = false;
            col.AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize;

            //SourceGrid.Cells.Editors.TextBoxNumeric numericEditor = new SourceGrid.Cells.Editors.TextBoxNumeric(typeof(double));
            //numericEditor.TypeConverter = new DevAge.ComponentModel.Converter.NumberTypeConverter(typeof(double), "N");
            //numericEditor.AllowNull = true;  //the database value can be null (System.DbNull)

            col = AddColumn(ColumnsGrd.Quantity, "Số lượng", typeof(double));
            col.Width = 60;
            col.AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSizeView;

            //col = AddColumn(ColumnsGrd.PriceInExcBuying, "Đơn giá", typeof(double));
            col = AddColumn(ColumnsGrd.UnitPrice, "Đơn giá", typeof(double));
            col.Width = 80;
            col.AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSizeView;

            col = AddColumn(ColumnsGrd.AmtLineInExc, "Thành tiền", typeof(double));
            col.Width = 100;
            col.AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSizeView;

            col = AddColumn(ColumnsGrd.VAT, "VAT", typeof(int));
            col.Width = 60;
            col.AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSizeView;

            col = AddColumn(ColumnsGrd.AmtTaxLineInExc, "Tiền thuế", typeof(double));
            col.Width = 100;
            col.AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSizeView;

            col = AddColumn(ColumnsGrd.AmtLineInExc, "Tổng cộng", typeof(double));
            col.DataCell.Editor.EnableEdit = false;
            col.Width = 100;
            col.AutoSizeMode = SourceGrid.AutoSizeMode.EnableStretch;

            //col = AddColumn(ColumnsGrd.NoteLine, "Ghi chú", typeof(string));
            //col.Width = 150;
            //col.AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize;

            col = AddColumn(tagVch.BuyCapAss.ItemLine, "", typeof(int));
            col.Width = 0;
            col.AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize;
           
            grdData.AutoStretchColumnsToFitWidth = true;
            grdData.ListFieldMember =
                StringHelper.ConvertArrayToString(", ", ColumnsGrd.CapAssID, ColumnsGrd.CapAssName, ColumnsGrd.AmtLineInExc, ColumnsGrd.AmtTaxLineInExc, ColumnsGrd.AmtLineInExc, ColumnsGrd.ItemLine, ColumnsGrd.Quantity, ColumnsGrd.Specification, ColumnsGrd.Unit, ColumnsGrd.UnitPrice, ColumnsGrd.VAT);
        }
	    #endregion
        
        #region Public Method
        //public void CalcAmtItemLine(int pRow, string pColName)
        //{
        //    double dPrice = grdData.GetValueDoubleDataCell(pRow, ColumnsGrd.UnitPrice);
        //    double dPriceSvc = grdData.GetValueDoubleDataCell(pRow, tagVch.Inv.PriceSvcInExc);
        //    double dQty = grdData.GetValueDoubleDataCell(pRow, ColumnsGrd.Quantity);
        //    double dAmtLine = grdData.GetValueDoubleDataCell(pRow, ColumnsGrd.AmtLineInExc);
        //    double dAmtTaxLineInExc = grdData.GetValueDoubleDataCell(pRow, ColumnsGrd.AmtTaxLineInExc);
        //    double dAmtTtlLineInExc = grdData.GetValueDoubleDataCell(pRow, ColumnsGrd.AmtTtlLineInExc);
        //    double dAmtLineSvcInExc = grdData.GetValueDoubleDataCell(pRow, tagVch.Inv.AmtLineSvcInExc);
        //    double dTaxRate = grdData.GetValueDoubleDataCell(pRow, ColumnsGrd.VAT);

        //    if (pColName.Equals(ColumnsGrd.Quantity) || pColName.Equals(ColumnsGrd.UnitPrice) || pColName.Equals(ColumnsGrd.CapAssID))
        //    {
        //        dAmtLine = dPrice * dQty;
        //        dAmtTaxLineInExc = dAmtLine * dTaxRate / 100;
        //        dAmtTtlLineInExc = dAmtLine + dAmtTaxLineInExc;
        //        // Can tinh lai tong tien cho dAmtLineSvcInExc
        //        //dAmtLineSvcInExc = (dPriceSvc * dQty) + d 

        //    }
        //    else if (pColName.Equals(ColumnsGrd.AmtLineInExc))
        //    {
        //        dPrice = (dQty == 0) ? 0 : dAmtLine / dQty;
        //        dAmtTaxLineInExc = dAmtLine * dTaxRate / 100;
        //        dAmtTtlLineInExc = dAmtLine + dAmtTaxLineInExc;
        //    }
        //    else if (pColName.Equals(ColumnsGrd.AmtTaxLineInExc))
        //    {
        //        if (dAmtTaxLineInExc == 0)
        //            dTaxRate = 0;
        //        dAmtTtlLineInExc = dAmtLine + dAmtTaxLineInExc;
        //    }
        //    else if (pColName.Equals(ColumnsGrd.VAT))
        //    {
        //        dAmtTaxLineInExc = dAmtLine * dTaxRate / 100;
        //        dAmtTtlLineInExc = dAmtLine + dAmtTaxLineInExc;
        //    }

        //    grdData.SetValueCell(pRow, ColumnsGrd.UnitPrice, dPrice);
        //    grdData.SetValueCell(pRow, ColumnsGrd.Quantity, dQty);
        //    grdData.SetValueCell(pRow, ColumnsGrd.AmtLineInExc, dAmtLine);
        //    grdData.SetValueCell(pRow, ColumnsGrd.AmtTaxLineInExc, dAmtTaxLineInExc);
        //    grdData.SetValueCell(pRow, ColumnsGrd.AmtTtlLineInExc, dAmtTtlLineInExc);

        //    grdData.SetValueCell(pRow, tagVch.Inv.PrimeCostInExc, (dQty == 0) ? 0 : dAmtTtlLineInExc / dQty);
        //    grdData.SetValueCell(pRow, tagVch.Inv.AmtPrimeCostLineInExc, dAmtTtlLineInExc);
        //}
        //public void CalcAllRowsAmtItemLine(string pColName)
        //{
        //    double mAllAmtItem = 0;
        //    int count = grdData.ReadOnly == true ? grdData.Rows.Count : grdData.Rows.Count - 1;
        //    for (int i = 1; i < count; i++)
        //    {
        //        CalcAmtItemLine(i, pColName);
        //        mAllAmtItem += (double)ValueHelper.ChangeType(grdData.GetValueDataCell(i, ColumnsGrd.AmtLineInExc), typeof(double));
        //    }
        //    txtTT.Double = mAllAmtItem;
        //}
        //public void SetStyleOverInstock(Color pForeColor)
        //{
        //    SourceGrid.Cells.Views.Cell viewSelected = new SourceGrid.Cells.Views.Cell();
        //    viewSelected.Font = new Font(grdData.Font, FontStyle.Bold);
        //    viewSelected.ForeColor = pForeColor;
        //    //viewSelected.BackColor = Color.Chocolate;
        //    //Create selected conditions
        //    SourceGrid.Conditions.ConditionView selectedConditionBold = new SourceGrid.Conditions.ConditionView(viewSelected);
        //    selectedConditionBold.EvaluateFunction = delegate(SourceGrid.DataGridColumn column, int gridRow, object itemRow)
        //    {
        //        DataRowView row = (DataRowView)itemRow;
        //        if (row == null)
        //            return false;
        //        bool v = ValueHelper.ChangeBooleanType(Aulac.Global.Data.DataTableProcess.GetValue(row.Row, tagVch.Inv.OverInstock));
        //        //return row[tagVch.Inv.OverInstock] is bool &&  !ValueHelper.isEmpty(row[tagVch.Inv.OverInstock]) && (bool)row[tagVch.Inv.OverInstock] == true;
        //        return v;
        //    };

        //    foreach (SourceGrid.DataGridColumn col in grdData.Columns)
        //    {
        //        col.Conditions.Add(selectedConditionBold);
        //    }

        //}
        //public void CleareStyleOverInstock()
        //{
        //    foreach (SourceGrid.DataGridColumn col in grdData.Columns)
        //    {
        //        col.Conditions.Clear();
        //    }
        //}

        #endregion
    }
}
